#!/usr/bin/env python
# coding=utf-8
# __author__ = 'Yunchao Ling'

def CalXref(filename):
    ht={}
    infile=open(filename,'r')
    for line in infile:
        line=line.rstrip()
        if line.startswith("xref:"):
            val=line[6:]
            source=val.split(":")[0]
            if ht.has_key(source):
                ht[source]+=1
            else:
                ht[source]=1
    infile.close()
    for item in ht.keys():
        print item+"\t"+str(ht[item])

if __name__ == "__main__":
    CalXref("D:/data/ontology/doid.obo")